using System.Drawing;
using GTA;
using NativeUI;

namespace CustomPeds.Menus;

public class TattooMenu : Script
{
    public static UIMenu menu = new UIMenu("", TextSetting.tato_Menu, new Point(0, -107));
    private static bool inited;

    public TattooMenu()
    {
        if (!inited)
        {
            Main.pool.Add(menu);
            Build();
            inited = true;
        }
    }

    public static void Open()
    {
        if (!inited) return;
        menu.Visible = true;
        menu.RefreshIndex();
    }

    private static void Build()
    {
        menu.Clear();
        menu.SetBannerType(new UIResRectangle());
        // 与 Reference 保持一致的列表/子菜单结构
        var tattooList = new System.Collections.Generic.List<dynamic>(new string[4] { "1", "2", "3", "4" });
        var tattooItem = new UIMenuListItem(TextSetting.tb_ListItem_Group, tattooList, 0);
        menu.AddItem(tattooItem);
        menu.AddItem(new UIMenuItem($"{TextSetting.tb_MenuItem_Torso} {tattooList[tattooItem.Index]}", TextSetting.tb_TextTips_NULL));
        menu.AddItem(new UIMenuItem($"{TextSetting.tb_MenuItem_Head} {tattooList[tattooItem.Index]}", TextSetting.tb_TextTips_NULL));
        menu.AddItem(new UIMenuItem($"{TextSetting.tb_MenuItem_LeftArm} {tattooList[tattooItem.Index]}", TextSetting.tb_TextTips_NULL));
        menu.AddItem(new UIMenuItem($"{TextSetting.tb_MenuItem_RightArm} {tattooList[tattooItem.Index]}", TextSetting.tb_TextTips_NULL));
        menu.AddItem(new UIMenuItem($"{TextSetting.tb_MenuItem_LeftLeg} {tattooList[tattooItem.Index]}", TextSetting.tb_TextTips_NULL));
        menu.AddItem(new UIMenuItem($"{TextSetting.tb_MenuItem_RightLeg} {tattooList[tattooItem.Index]}", TextSetting.tb_TextTips_NULL));
        menu.AddItem(new UIMenuItem($"{TextSetting.tb_MenuItem_ClearGroup} {tattooList[tattooItem.Index]}"));
        for (int i = 1; i < 7; i++)
        {
            menu.BindMenuToItem(TattooSubMenu.menu, menu.MenuItems[i]);
        }
        menu.RefreshIndex();
    }
}


